import 'package:animal/constant/color.dart';
import 'package:animal/constant/font.dart';
import 'package:animal/ui/login/controller/for_get_pwd_controller.dart';
import 'package:animal/utils/screen_util.dart';
import 'package:animal/widgets/appbar_widget.dart';
import 'package:animal/widgets/code/code_input_page.dart';
import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:get/get.dart';

///忘记密码
class ForGetPwdPage extends StatelessWidget {
  const ForGetPwdPage({Key? key}) : super(key: key);

  @override
  Widget build(BuildContext context) {
    final controller = Get.put(ForGetPwdController());
    return Scaffold(
      resizeToAvoidBottomInset: false,
      backgroundColor: KColorConstant.appBgColor,
      appBar: AppBarWidget.defaultAppBar(
        backgroundColor: Colors.white,
        centerTitle: true,
        title: const Text("找回登录密码"),
        elevation: 0,
      ),
      body: Column(
        children: [
          Container(
            color: KColorConstant.white,
            margin: EdgeInsets.only(top: ScreenUtil().L(10),bottom: ScreenUtil().L(30)),
            padding: EdgeInsets.symmetric(horizontal: ScreenUtil().L(20), vertical: ScreenUtil().L(15)),
            child: Column(
              crossAxisAlignment: CrossAxisAlignment.start,
              children: [
                Text("手机号码", style: KFontConstant.myTextStyle(size: 15, bold: true, color: KColorConstant.black222)),
                Container(
                  width: double.infinity,
                  margin: EdgeInsets.symmetric(vertical: ScreenUtil().L(15)),
                  padding: EdgeInsets.symmetric(horizontal: ScreenUtil().L(10)),
                  decoration: BoxDecoration(borderRadius: BorderRadius.circular(ScreenUtil().L(10)), color: const Color(0X19F8BC3C)),
                  child: TextField(
                    controller: controller.phoneController,
                    maxLength: 11,
                    maxLines: 1,
                    decoration: InputDecoration(
                        counterText: "",
                        hintText: "请输入手机号码",
                        hintStyle: KFontConstant.myTextStyle(size: 15, color: KColorConstant.black666666),
                        border: InputBorder.none),
                  ),
                ),
                Text("验证码", style: KFontConstant.myTextStyle(size: 15, bold: true, color: KColorConstant.black222)),
                Container(
                    width: double.infinity,
                    margin: EdgeInsets.symmetric(vertical: ScreenUtil().L(15)),
                    padding: EdgeInsets.symmetric(horizontal: ScreenUtil().L(10)),
                    decoration: BoxDecoration(borderRadius: BorderRadius.circular(ScreenUtil().L(10)), color: const Color(0X19F8BC3C)),
                    child: CodeInputPage(
                      textEditingController: controller.codeController,
                      phoneEditingController: controller.phoneController,
                      decoration: const BoxDecoration(),
                      btnColor: const Color(0XFF19ACE5),
                      textStyle: KFontConstant.myTextStyle(size: 15, color: KColorConstant.black666666),
                      tag: "forgetPwd",
                    )),
                Text("新密码", style: KFontConstant.myTextStyle(size: 15, bold: true, color: KColorConstant.black222)),
                Container(
                  width: double.infinity,
                  margin: EdgeInsets.only(top: ScreenUtil().L(15),bottom: ScreenUtil().L(10)),
                  padding: EdgeInsets.symmetric(horizontal: ScreenUtil().L(10)),
                  decoration: BoxDecoration(borderRadius: BorderRadius.circular(ScreenUtil().L(10)), color: const Color(0X19F8BC3C)),
                  child: TextField(
                    maxLength: 20,
                    style: KFontConstant.myTextStyle(size: 15),
                    controller: controller.pwdController,
                    decoration: InputDecoration(
                        counterText: "",
                        hintText: "请输入新密码",
                        hintStyle: KFontConstant.myTextStyle(size: 15, color: KColorConstant.black666666),
                        border: InputBorder.none),
                  ),
                ),
                Text("密码由6-20位英文字母、数字或符号组成", style: KFontConstant.myTextStyle(size: 15, color: const Color(0XFF19ACE5))),
              ],
            ),
          ),
          CupertinoButton (
            onPressed: () => controller.pwdReset(),
            borderRadius: BorderRadius.circular(ScreenUtil().L(5)),
            child: Container(margin: EdgeInsets.symmetric(horizontal: ScreenUtil().L(30)),child: Text("确定",style: KFontConstant.myTextStyle(size: 15, color: KColorConstant.white),)),
            color: KColorConstant.btnColor19ACE5,
          )
        ],
      ),
    );
  }
}
